/** 注释
 * @Name index;
 * @Author FiveXu
 * @Description index
 * @Date 2023-01-04 15:17
 */
export const requireUrl = (url: string) => {
  return new URL(url, import.meta.url).pathname
}
/** 骇客技术添加css样式
 * @param style style名
 */
export const prefixStyle = (style: string): string | number => {
  const vendor = (() => {
    const transformName = {
      webkit: 'webkitTransform',
      Moz: 'MozTransform',
      O: 'OTransform',
      ms: 'msTransform',
      standard: 'transform'
    }
    for (const key in transformName) {
      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      // @ts-ignore
      const domKey = document.createElement('div').style[transformName[key]]
      if (domKey !== undefined) return key
    }
    return false
  })()
  if (!vendor) return ''
  if (vendor === 'standard') return style
  return vendor + style.charAt(0).toUpperCase() + style.substr(1)
}
